﻿<Serializable()> _
Public Class clsNotificationSound
	Inherits clsBaseClass

	Private strSoundFilePath As String
	Private strSysSoundName As String

	Private booPlaySoundFile As Boolean
	Private booPlaySystemSound As Boolean

	Public Property SoundFilePath() As String
		Get
			Return strSoundFilePath
		End Get
		Set(ByVal value As String)
			strSoundFilePath = value
		End Set
	End Property

	Public Property SystemSound() As String
		Get
			Return strSysSoundName
		End Get
		Set(ByVal value As String)
			strSysSoundName = value
		End Set
	End Property

	Public Property PlaySoundFile() As Boolean
		Get
			Return booPlaySoundFile
		End Get
		Set(ByVal value As Boolean)
			booPlaySoundFile = value
		End Set
	End Property

	Public Property PlaySystemSound() As Boolean
		Get
			Return booPlaySystemSound
		End Get
		Set(ByVal value As Boolean)
			booPlaySystemSound = value
		End Set
	End Property

	Public Function PlaySound() As Boolean
		If PlaySystemSound Then
			If SystemSound Is Nothing Then Return False
			Dim sound As Media.SystemSound = Nothing
			Select Case SystemSound
				Case "Asterisk"
					sound = Media.SystemSounds.Asterisk
				Case "Beep"
					sound = Media.SystemSounds.Beep
				Case "Exclamation"
					sound = Media.SystemSounds.Exclamation
				Case "Hand"
					sound = Media.SystemSounds.Hand
				Case "Question"
					sound = Media.SystemSounds.Question
			End Select
			If sound Is Nothing Then Return False
			Return modCommon.PlaySound(sound)
		Else
			Return modCommon.PlaySound(SoundFilePath)
		End If
	End Function

	Public Sub New()
		SystemSound = "Asterisk"
	End Sub

	Public Overrides Sub Dispose()
		SystemSound = Nothing
		SoundFilePath = Nothing
		MyBase.Dispose()
	End Sub

	Public Overrides Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
		MyBase.GetObjectData(info, context)
		info.AddValue("PlaySystemSound", PlaySystemSound)
		info.AddValue("PlaySoundFile", PlaySoundFile)
		info.AddValue("SoundFilePath", SoundFilePath)
		info.AddValue("SystemSound", SystemSound)
	End Sub
End Class
